package com.haixiaoke.saas.repository.service.impl;

import com.haixiaoke.saas.repository.mapper.OrderOperatingRecordMapper;
import com.haixiaoke.saas.repository.pojo.OrderOperatingRecord;
import com.haixiaoke.saas.repository.service.IOrderOperatingRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单记录Service业务层处理
 *
 * @author haixiaoke
 * @date 2023-04-12
 */
@Service
public class OrderOperatingRecordServiceImpl implements IOrderOperatingRecordService {
    @Autowired
    private OrderOperatingRecordMapper orderOperatingRecordMapper;

    /**
     * 查询订单记录
     *
     * @param orderRecordId 订单记录主键
     * @return 订单记录
     */
    @Override
    public OrderOperatingRecord selectOrderOperatingRecordByOrderRecordId(Long orderRecordId) {
        return orderOperatingRecordMapper.selectOrderOperatingRecordByOrderRecordId(orderRecordId);
    }

    /**
     * 查询订单记录列表
     *
     * @param orderOperatingRecord 订单记录
     * @return 订单记录
     */
    @Override
    public List<OrderOperatingRecord> selectOrderOperatingRecordList(OrderOperatingRecord orderOperatingRecord) {
        return orderOperatingRecordMapper.selectOrderOperatingRecordList(orderOperatingRecord);
    }

    /**
     * 新增订单记录
     *
     * @param orderOperatingRecord 订单记录
     * @return 结果
     */
    @Override
    public int insertOrderOperatingRecord(OrderOperatingRecord orderOperatingRecord) {
        return orderOperatingRecordMapper.insertOrderOperatingRecord(orderOperatingRecord);
    }

    /**
     * 修改订单记录
     *
     * @param orderOperatingRecord 订单记录
     * @return 结果
     */
    @Override
    public int updateOrderOperatingRecord(OrderOperatingRecord orderOperatingRecord) {
        return orderOperatingRecordMapper.updateOrderOperatingRecord(orderOperatingRecord);
    }

    /**
     * 批量删除订单记录
     *
     * @param orderRecordIds 需要删除的订单记录主键
     * @return 结果
     */
    @Override
    public int deleteOrderOperatingRecordByOrderRecordIds(Long[] orderRecordIds) {
        return orderOperatingRecordMapper.deleteOrderOperatingRecordByOrderRecordIds(orderRecordIds);
    }

    /**
     * 删除订单记录信息
     *
     * @param orderRecordId 订单记录主键
     * @return 结果
     */
    @Override
    public int deleteOrderOperatingRecordByOrderRecordId(Long orderRecordId) {
        return orderOperatingRecordMapper.deleteOrderOperatingRecordByOrderRecordId(orderRecordId);
    }

    /**
     * 根据订单id查询订单异常记录
     * @param orderId   订单id
     * @return
     */
    @Override
    public List<OrderOperatingRecord> getRecordByOrderId(Long orderId) {
        return orderOperatingRecordMapper.getRecordByOrderId(orderId);
    }

    @Override
    public OrderOperatingRecord selectOperatingOrderCancel(String orderId, Integer orderState, Integer orderStateUnPayment) {
        return orderOperatingRecordMapper.selectOperatingOrderCancel(orderId,orderState,orderStateUnPayment);
    }

    @Override
    public void deleteOrderOperatingRecordByOrderId(String orderId) {
        orderOperatingRecordMapper.deleteOrderOperatingRecordByOrderId(orderId);
    }

    @Override
    public OrderOperatingRecord selectOrderOperatingRecordByOrderId(String orderId) {
        return orderOperatingRecordMapper.selectOrderOperatingRecordByOrderId(orderId);
    }

    @Override
    public OrderOperatingRecord selectOrderOperatingRecordByOrderIdAndOperatingType(String orderId, Integer operatingType) {
        return orderOperatingRecordMapper.selectOrderOperatingRecordByOrderIdAndOperatingType(orderId,operatingType);
    }
}
